<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<head>
</head>
<script type="text/javascript" src="./jquery.js"></script>
<script type="text/javascript">
	var host = "http://mark.woyoushi.com/";
	var api_url = "webapi/application/banner";
	//ajax jquery 封装js
	$.ajax({
		url:"",//请求地址
		type:"",//http请求方式 get post
		dataType:"",//希望返回的额数据格式,json
		data:{},//上传数据
		success:function(r){},//请求成功后，回调的函数,r 响应的数据
		error:function(e){} //请求失败后回调
	});
	
    function banner(){
		var url = host + api_url;
		$.ajax({
			url:url,
			type:'post',
			dataType:'json',
			data:{
				deviceId:'test_deviceId',
				sign:'A97936C5DEC945B9E2C79B213A1C4E44'
			},
			success:function(r){
				console.log(r);
				var html = "{<br/>";
				for(var p in r){
					if(p=='data'){
						html = html + "&nbsp;[<br/>";
						var data = r['data'];
						for(var t in data){
							html = html + "&nbsp;&nbsp;{<br/>" 
								 + "&nbsp;&nbsp;" +"\""+ "type" + "\":"+ data[t].type + ',<br/>'
								 + "&nbsp;&nbsp;" +"\""+ "position" + "\":"+ data[t].position + ',<br/>'
								 + "&nbsp;&nbsp;" +"\""+ "title" + "\":"+ data[t].title + ',<br/>'
								 + "&nbsp;&nbsp;" +"\""+ "imageUrl" + "\":"+ data[t].imageUrl + ',<br/>},<br/>';
						}
						html = html + "&nbsp;&nbsp;]<br/>";
					}else{
						html = html + "&nbsp;" +"\""+ p + "\":"+ r[p] + ',<br/>';
					}
					
				}
				html += "}";
				$("#dd").html(html);
			},
			error:function(e){
				console.log(e);
			}
		});
	}
</script>
<body>
<img height="120px"
     src="https://s3mm1.abcpen.com/154339106190822236925.png"></img>
<br/>
<div style="padding-top:10px;">
	<button id="btn" type="button" onclick="banner()">点击</button>
</div>
<br/>
<div>
    <div id="dd"></div>
</div>
</body>
</html>